Spot-On
spot-on-rss.h
1 /*
2 ** Copyright (c) 2011 - 10^10^10, Alexis Megas.
3 ** All rights reserved.
4 **
5 ** Redistribution and use in source and binary forms, with or without
6 ** modification, are permitted provided that the following conditions
7 ** are met:
8 ** 1. Redistributions of source code must retain the above copyright
9 ** notice, this list of conditions and the following disclaimer.
10 ** 2. Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
13 ** 3. The name of the author may not be used to endorse or promote products
14 ** derived from Spot-On without specific prior written permission.
15 **
16 ** SPOT-ON IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 ** SPOT-ON, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef _spoton_rss_h_
29 #define _spoton_rss_h_
30 
31 #include <QFuture>
32 #include <QNetworkAccessManager>
33 #include <QNetworkReply>
34 #include <QTimer>
35 
36 #include "ui_spot-on-rss.h"
37 
38 class spoton_crypt;
39 
40 class spoton_rss: public QMainWindow
41 {
42  Q_OBJECT
43 
44  public:
45  spoton_rss(QWidget *parent);
46  ~spoton_rss();
47  void center(QWidget *parent);
48  void deactivate(void);
49  void prepareAfterAuthentication(void);
50  void show(void);
51 
52  private:
53  QByteArray m_feedDownloadContent;
54  QFuture<void> m_importFuture;
55  QFuture<void> m_parseXmlFuture;
56  QNetworkAccessManager m_networkAccessManager;
57  QPalette m_originalFindPalette;
58  QString removeSpecialTags(const QString &text);
59  QTimer m_downloadTimer;
60  QTimer m_downloadContentTimer;
61  QTimer m_importTimer;
62  QTimer m_statisticsTimer;
63  Ui_spoton_rss m_ui;
64  int m_currentFeedRow;
65  bool importUrl(const QList<QVariant> &list, const int maximumKeywords);
66  spoton_crypt *urlCommonCrypt(void) const;
67  void closeEvent(QCloseEvent *event);
68  void hideUrl(const QUrl &url, const bool state);
69  void import(const int maximumKeywords);
70  void parseXmlContent(const QByteArray &data,
71  const QUrl &url);
72  void populateFeeds(void);
73  void prepareDatabases(void);
74  void saveFeedData(const QString &description,
75  const QString &link,
76  const QString &title);
77  void saveFeedImage(const QByteArray &data, const QString &link);
78  void saveFeedLink(const QString &description,
79  const QString &link,
80  const QString &publicationDate,
81  const QString &title,
82  const QUrl &url);
83 
84  private slots:
85  void slotActivate(bool state);
86  void slotActivateImport(bool state);
87  void slotAddFeed(void);
88  void slotContentReplyFinished(void);
89  void slotCopyFeedLink(void);
90  void slotDeleteAllFeeds(void);
91  void slotDeleteFeed(void);
92  void slotDownloadContent(void);
93  void slotDownloadFeedImage(const QUrl &imageUrl, const QUrl &url);
94  void slotDownloadIntervalChanged(double value);
95  void slotDownloadTimeout(void);
96  void slotFeedImageReplyFinished(void);
97  void slotFeedReplyFinished(void);
98  void slotFeedReplyReadyRead(void);
99  void slotFind(void);
100  void slotFindInitialize(void);
101  void slotImport(void);
102  void slotLogError(const QString &error);
103  void slotMaximumKeywordsChanged(int value);
104  void slotPopulateFeeds(void);
105  void slotProxyClicked(bool state);
106  void slotPurge(void);
107  void slotPurgeDaysChanged(int value);
108  void slotRefreshTimeline(void);
109  void slotRemoveMalformed(void);
110  void slotReplyError(QNetworkReply::NetworkError code);
111  void slotSaveProxy(void);
112  void slotScheduleFeedUpdate(void);
113  void slotShowContextMenu(const QPoint &point);
114  void slotStatisticsTimeout(void);
115  void slotTabChanged(int index);
116  void slotTimeOrderBy(bool state);
117  void slotTimelineShowOption(bool state);
118  void slotToggleState(void);
119  void slotUrlClicked(const QUrl &url);
120 
121  signals:
122  void downloadFeedImage(const QUrl &imageUrl, const QUrl &url);
123  void logError(const QString &error);
124 };
125 
126 #endif
Definition: spot-on-rss.h:40
Definition: spot-on-crypt.h:65